<template>
    <div class="container">
        <Head :title="title" :type="type" />
        <div class="content">
            <div class="title">{{ articleData.title }}</div>
            <div class="subTitle">
                <div class="subTitleText">来源：{{ articleData.deptname }}</div>
                <div class="subTitleText">
                    时间：{{ articleData.updatetime }}
                </div>
            </div>
            <div class="text" v-html="articleData.content"></div>
            <div class="file" v-if="articleData.filename !== null">
                <div class="fileTitle">附件</div>
                <div
                    class="fileItem"
                    v-for="(item, index) in articleData.filename.split(',')"
                    :key="index"
                >
                    <p @click="download(index)">{{ item }}</p>
                </div>
            </div>
            <div class="btns">
                <div class="btnContent" @click="nogood">
                    <van-icon name="good-job-o" class="goodIcon" size="25" />
                    <p>已解决</p>
                </div>
                <div class="btnContent" @click="nogood">
                    <van-icon name="good-job-o" class="nogoodIcon" size="25" />
                    <p>未解决</p>
                </div>
            </div>
        </div>
        <van-popup
            v-model:show="$store.state.popupFeedback"
            :style="{ width: '100%', height: '100vh' }"
            ><Feedback
        /></van-popup>
    </div>
</template>

<script>
import Head from "@/components/head.vue";
import Feedback from "../views/Feedback.vue";
import request from "@/utils/request";
// import qs from "qs";
export default {
    props: ["articleData"],
    data() {
        return {
            title: "知识信息查看",
            type: 1,
        };
    },
    methods: {
        nogood() {
            this.$store.state.popupFeedback = true;
        },
        //附件下载
        download(index) {
            let data = this.articleData.filepath.split(",")[index];
            let url = `${process.env.VUE_APP_BASE_API}/12345epi/knowledge/downloadFile.json?sn=${data}`;
            window.open(url);
        },
    },
    components: {
        Head,
        Feedback,
    },
};
</script>

<style lang="less" scoped>
.container {
    .content {
        padding: 0 20px;
        .title {
            margin-top: 9px;
            font-size: 18px;
            font-weight: bold;
            color: #000000;
        }
        .subTitle {
            margin-top: 20px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            .subTitleText {
                font-size: 12px;
                font-weight: bold;
                color: #666666;
            }
        }
        .text {
            margin-top: 16px;
            font-size: 14px;
            color: #000000;
        }
        .file {
            border: 1px solid #ddd;
            margin-top: 20px;
            padding: 10px;
            border-radius: 10px;
            position: relative;
            .fileTitle {
                position: absolute;
                top: -10px;
                background: #fff;
                font-size: 14px;
            }
            .fileItem {
                margin-top: 5px;
                font-size: 14px;
                color: #4facfe;
                cursor: pointer;
            }
        }
        .btns {
            padding: 15px 0;
            display: flex;
            align-items: center;
            justify-content: space-evenly;
            .btnContent {
                display: flex;
                align-items: center;
                cursor: pointer;
                .goodIcon {
                    color: #2abc4d;
                }
                .nogoodIcon {
                    transform: rotate(180deg);
                    color: #ff0e19;
                }
                p {
                    font-size: 14px;
                    font-weight: bold;
                    color: #000000;
                    border-bottom: 1px solid #02adea;
                }
            }
        }
    }
}
</style>